﻿using System.Windows.Input;
using Inovout.Business;
using System.Collections.Generic;

namespace Inovout.Gui.Wpf.Controls
{
    public class MenuItemViewModel : ButtonViewModel
    {
        public string Header
        {
            get { return function.Name; }
        }
        public string HotKey
        {
            get;
            set;
        }
        private List<MenuItemViewModel> items;
        public List<MenuItemViewModel> Items
        {
            get
            {
                if (items == null)
                {
                    items = new List<MenuItemViewModel>();
                    if (function is FunctionGroup)
                    {
                        foreach (IFunction f in ((FunctionGroup)function).Functions)
                        {
                            items.Add(new MenuItemViewModel(f));
                        }
                    }
                }
                return items;
            }
            set { items = value; }
        }

        public ICommand Command
        {
            get
            {
                if (function is Function)
                {
                    return null;
                    //                    return new ViewModelCommand(function as Function);
                }
                else
                {
                    return null;
                }
            }
            set { }
        }
        public bool IsChecked
        {
            get;
            set;
        }

        public bool IsCheckable
        {
            get;
            set;
        }
        private IFunction function;
        public MenuItemViewModel()
        {
        }
        public MenuItemViewModel(IFunction function)
        {
            this.function = function;
        }
    }
}
